<?php
	include("admin-commons.php");

	$user = $_COOKIE['user'];
	$hash = $_COOKIE['hash'];
	
	if(strlen($user) == 0)
	{
		echo "<html>\n";
		echo "<h2>You must be logged in to view this page, you have been reported.</h2>\n";
		echo "</html>\n";
		die();
	}
	/* Begin Page */
	$request = $_GET['request'];
	pageHeader();
	adminNavigation();
	contentHeader();
	if (strlen($request) == 0)
		getRequest();
	else
		displayLogFile($request);
	contentFooter("You are logged in as ".$user);
	
	function getRequest() {
		echo "<h2>Security</h2>\n";
		echo "</br>Select a log file to view.</br>";
		echo "<form action=\"security.php\" method=\"get\">\n";
		echo "</br><b>Log file: </b>\n";
		echo "<select name=\"request\">\n";
		echo "<option>mysql.log</option>\n";
		echo "<option>mysql.err</option>\n";
		echo "</select></br>\n";
		echo "</br><input type=\"submit\" value=\"View Log File\"/>\n";
		echo "</form></br></br>\n";
	}
	
	function displayLogFile($file) {
		echo "<h2>".$file."</h2></br>\n";
		include($file);
	}
?>